package fr.umlv.jee.jawp.persistence.object;

import java.io.Serializable;

@SuppressWarnings("serial")
public class Category implements Content, Serializable {

	// members
	private int id;

	private int motherCategory = -1;
	private String name;


	public Category() {

	}

	// getters
	public String getName() {
		return name;
	}

	public int getMotherCategory() {
		return motherCategory;
	}

	public int getId() {
		return id;
	}

	// setters
	public void setName(String newName) {
		this.name = newName;
	}

	public void setMotherCategory(int newMotherCategory) {
		this.motherCategory = newMotherCategory;
	}

	public void setId(int id) {
		this.id = id;
	}

	// generic methods
	@Override
	public String toString() {
		return "Category named " + name + " (id = " + id + ")";
	}

	@Override
	public boolean equals(Object obj) {
		if ((obj instanceof Category) && (this.id == ((Category) obj).id))
			return true;
		return false;
	}
}
